#include <iostream>
#include <algorithm>

using namespace std;

const int N = 3e4 + 10;

int n, w;
int a[N];

int main()
{
	cin >> w >> n;
	for(int i = 1; i <= n; i++) cin >> a[i];
	sort(a + 1, a + 1 + n);

	int l = 1, r = n;
	int ret = 0;
	while(l <= r)
	{
		if(a[l] + a[r] <= w) l++, r--;
		else r--;
		ret++;
	}
	cout << ret << endl;

	return 0;
}

